//
//  UserInfoViewController.swift
//  IDPNativeApp
//  本VC只是一个简单的显示登录账号信息的界面，表示用户已经处在登录状态
//  Created by 九州云腾 on 16/11/11.
//  Copyright © 2016年 九州云腾. All rights reserved.
//

import UIKit
import Alamofire
import STSFramework
class UserInfoViewController: UIViewController {
    var username = String()
    var serverIp = String()
    var refreshToken = String()
    var isSSO: Bool = false;
    
    @IBOutlet weak var messageLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.messageLabel.text = "idToken：\(self.username)"
    
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

    }

    @IBAction func refreshToken(_ sender: Any) {

        // 请求接口
        




        STSSDK.refreshId_token(requestURL: "\(self.serverIp)/api/public/sts/refresh_id_token", username: "86627161@qq.com", refresh_token: self.refreshToken, success: { (result) in
            DispatchQueue.main.async(execute: {

                self.messageLabel.text = "idToken：\(result["id_token"] as! String)"
                
            })
        }) { (error) in
            print(error)
        }


    }


    @IBAction func cancel(_ sender: Any) {

        self.dismiss(animated: true, completion: nil);

    }


}
